package S08.first;

import java.util.Arrays;
import java.util.Comparator;

public class F02 {
	public static final Comparator<Student> sortByHeight=new Comparator<Student>() {
		@Override
		public int compare(Student s1, Student s2) {
			return Double.compare(s1.getHeight(), s2.getHeight()); //按身高排序
		}
	};
	public static void main(String[] args) {
		
		Student[]a= {
				new Student("20240102", "张三", 20, 1.75, 65.5),
				new Student("20240103", "李四", 21, 1.85, 66),
				new Student("20240101", "王五", 19, 1.80, 75.5)
		};
		System.out.println("按身高对Student[]进行升序排序：");
		Arrays.sort(a, sortByHeight);
		for (Student student : a) {
			System.out.println(student);
		}
	}

}
